<template>
  <div>
    <Row>
      <i-col span="24">
        <Card>
          <Button class="opt-btn" @click="showSearchModal" type="primary">高级搜索</Button>
          <Tooltip class="opt-btn" content="刷新" placement="right">
            <Button icon="md-refresh" type="success" shape="circle" @click="searchTable(false)"></Button>
          </Tooltip>
                    <Tooltip class="opt-btn" content="重置搜索" placement="right">
                        <Button icon="md-repeat" type="success" shape="circle" @click="researchTable"></Button>
                    </Tooltip>
          <GoodsCategoryAttributeTable
            ref="table"
            v-on:searchTable="searchTable"
            v-on:showDetailModal="showDetailModal"
          />
        </Card>
      </i-col>
    </Row>
    <GoodsCategoryAttributeSearchModal ref="searchModal" v-on:searchTable="searchTable" />
    <GoodsCategoryAttributeDetailModal ref="detailModal" />
  </div>
</template>

<script>
import * as utils from '@/api/utils-v2'
import GoodsCategoryAttributeTable from './GoodsCategoryAttributeTable.vue'
import GoodsCategoryAttributeSearchModal from './GoodsCategoryAttributeSearchModal.vue'
import GoodsCategoryAttributeDetailModal from './GoodsCategoryAttributeDetailModal.vue'
import * as ResponseStatus from '@/api/response-status'
export default {
  name: 'GoodsCategoryAttributeMain',
  components: {
    GoodsCategoryAttributeTable,
    GoodsCategoryAttributeSearchModal,
    GoodsCategoryAttributeDetailModal,
  },
  data() {
    return {
      modal: {
        searchTableModal: false
      },
      urls: {
        oneUrl: '/goods-attribute/admin/one/'
      }
    }
  },
  computed: {},
  mounted() {},
  methods: {
    searchTable(reset) {
      utils.search(this, reset)
    },
    researchTable() {
                this.$refs.searchModal.resetForm()
                setTimeout(() => {
                    utils.search(this, true)
                }, 10);
            },
    showDetailModal(row) {
      let detailModal = this.$refs.detailModal
      detailModal.modal.detail = true
      detailModal.form = row
	    detailModal.getDictItemsDisplayValue()
    },
    showSearchModal() {
      let searchModal = this.$refs.searchModal
      searchModal.modal.search = true
    },
    showSearchTableModal() {
      this.modal['searchTableModal'] = true
    },
    /**
     * 取消模态窗
     */
    cancelModal(modal) {
      this.modal[modal] = false
    },
  }
}
</script>

<style>
</style>
